// facultystaff/pages/teachApply/teachApply.js
const columns = [{
    text: '事假',
    value: '1',

  },
  {
    text: '病假',
    value: '2',
  },
  {
    text: '年假',
    value: '3',
  },
  {
    text: '产假',
    value: '4',
  },
  {
    text: '陪产假',
    value: '5',
  },
  {
    text: '婚假',
    value: '6',
  },
  {
    text: '丧假',
    value: '7',
  },
];
Page({

  /**
   * 页面的初始数据
   */
  data: {
    show: false,
    shows: false,
    showPicker:false,
    showPicker2:false,
    fieldValue2:"",
    fieldValue3:"",
    time:"2小时",
    message:"",
    currentDate: new Date().getTime(),
    currentDate3: new Date().getTime(),
    steps: [{
        text: '步骤一',
        desc: '描述信息',
      },
      {
        text: '步骤二',
        desc: '描述信息',
      },
      {
        text: '步骤三',
        desc: '描述信息',
      },
      {
        text: '步骤四',
        desc: '描述信息',
      },
    ],
    columns: [{
        text: "事假",
        value: 1
      },
      {
        text: "病假",
        value: 1
      },
      {
        text: "年假",
        value: 1
      },
      {
        text: "产假",
        value: 1
      },
      {
        text: "陪产假",
        value: 1
      },
      {
        text: "婚假",
        value: 1
      },
      {
        text: "丧假",
        value: 1
      },
    ],
   
  },
  onDisplay1() {
    this.setData({
      show1: true
    });
  },
  onClick2(){
  this.setData({shows:true})
  },
  onClick3(){
    this.setData({show3:true})
    },
    cancel3(){
      this.setData({show3:false})
    },
  confirms(event){
    this.setData({shows:false})
    console.log(event.detail);
    this.setData({
      currentDate: new Date(event.detail),
    });
    this.setData({fieldValue2:new Date(event.detail).toLocaleString().substr(0,8)})
    this.setData({shows:false})
 
  },
  confirm3(event){
    this.setData({show3:false})
    console.log(event.detail);
    this.setData({
      currentDate3: new Date(event.detail),
    });
    this.setData({fieldValue3:new Date(event.detail).toLocaleString().substr(0,8)})
    this.setData({show3:false})
 
  },
  cancels(){
    this.setData({shows:false})
  },
  onClick() {
    this.setData({
      shows: true,
    });
  },
  onInput(event) {
    this.setData({
      currentDate: event.detail,
    });
  },
  notification() {
    this.setData({
      showPicker: true
    })
  },
  onCancel() {
    this.setData({
      showPicker: false
    })
  },
  onClose1() {
    this.setData({
      show1: false
    });
  },
  formatDate1(date) {
    date = new Date(date);
    return `${date.getFullYear()}/${date.getMonth() + 1}/${date.getDate()}`;
  },
  onConfirm1(event) {
    this.setData({
      show1: false,
      date: this.formatDate1(event.detail),
    });
  },
  onConfirm2(){
    this.setData({showPicker:false})
  },
  cancel2(){
    this.setData({showPicker:false})
  },
  reson2(){
    this.setData({showPicker2:true})
  },
  onConfirm(selectedOptions) {
    this.setData({
      showPicker: false
    })
    this.setData({
      fieldValue: selectedOptions.detail.value.text
    })
  },
  onClick() {
    this.setData({
      show: true,
    });
  },

  onClose() {
    this.setData({
      show: false,
    });
  },

  onFinish(e) {
    const {
      selectedOptions,
      value
    } = e.detail;
    const fieldValue = selectedOptions
      .map((option) => option.text || option.name)
      .join('/');
    this.setData({
      fieldValue,
      cascaderValue: value,
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})